Previous Book Contents Book Index Next

Inside Macintosh: Open Transport /
Chapter 3 - Endpoints / Endpoints Reference
Functions / Tearing Down a Connection


OTRcvDisconnect

Identifies the cause of a connection break or of a connection rejection, acknowledges and clears the corresponding disconnection event.

C INTERFACE
OSStatus OTRcvDisconnect(EndpointRef ref, TDiscon* discon);
C++ INTERFACE
OSStatus TEndpoint::RcvDisconnect(TDiscon* discon);
PARAMETERS
ref
The endpoint reference of the endpoint receiving the disconnection request.
discon
A pointer to a TDiscon structure that specifies any user data,
a reason for the disconnection, and a connection request sequence number.
DESCRIPTION
Calling the OTRcvDisconnect function clears the corresponding disconnection event and retrieves any user data sent with the disconnection.

If you do not care about data returned with the disconnection and do not need to know the reason for the disconnection nor the sequence ID, you may specify a nil pointer for the discon parameter. In this case, the provider discards any user data associated with the disconnection.

The OTRcvDisconnect function behaves in the same way for all modes of operation. If there is no disconnection request pending, the function returns with the kOTNoDisconnectErr result. If there is a disconnection request pending, the function returns either the kOTNoError or kOTBufferOverflowErr result. In the latter instance, you need to check the discon field of the TEndpointInfo structure for your endpoint and make sure that the buffer referenced by the udata.buf field is at least as big as the value specified for the discon field.

VALID STATES
T_DATAXFER, T_OUTCON, T_OUTREL, T_INREL, T_INCON (when there is more than one pending disconnection request)

SEE ALSO
To send an abortive disconnect, you call the OTSndDisconnect function (page 3-149).

You use the TDiscon structure (page 3-69) to specify that provides user data, a reason for the disconnection, and a connection request sequence number.

For information on how to use this function with a TCP/IP protocol, see page 8-19 in the TCP/IP chapter.

For information on how to use this function with AppleTalk protocols, see page 13-12 in the ADSP chapter and page 15-11 in the PAP chapter.

For information on abortive and orderly disconnects, see "Terminating a Connection," beginning on page 3-30.

You examine the discon field of the TEndpointInfo structure (page 3-48) to find out whether your endpoint supports sending data with the disconnection request and to determine the maximum size of such data.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 AUG 1996